money = 500  # 钱包
shopcar = []  # 购物车
shop = ['梨', '4090显卡', 'ps5', '小霸王', ]  # 商品栏
price = [5, 14999, 3999, 150]  # 价格栏

while 1:
    goods = input("要买什么呢？")
    if goods in ['q','Q']:
        print("结束购物")
        break
    if goods in shop:
        i = shop.index(goods)
        print("有", goods, "价格为", price[i])
        print("您的余额为", money)
        if money >= price[i]:
            shopcar.append(goods)
            money -= price[i]
            print("购买成功,您的余额为", money)
        else:
            print('穷鬼，钱不够！请到其他超市购买！')
    else:
        print("没有这个商品，别瞎弄！")
print('您购买的商品有:')
for i in shopcar:
    print(i,end='\t')